{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['广东', '安徽', '福建', '甘肃', '广西', '贵州', '海南', '河北', '黑龙江', '河南', '湖北', '湖南', '江苏', '江西', '吉林', '辽宁', '内蒙古', '宁夏', '青海', '山东', '山西', '陕西', '四川', '新疆', '西藏', '云南', '浙江', '北京', '天津', '上海', '重庆', '台湾']\n",
      "[736.11, 469.95, 324.31, 265.12, 250.35, 364.85, 93.42, 1095.54, 493.52, 857.87, 534.22, 429.94, 987.63, 260.57, 379.06, 975.6, 899.53, 207.15, 63.3, 1488.18, 1084.7, 529.89, 552.87, 405.6, nan, 321.42, 568.46, 175.15, 276.22, 333.79, 263.46, nan]\n",
      "[('广东', 736.11), ('安徽', 469.95), ('福建', 324.31), ('甘肃', 265.12), ('广西', 250.35), ('贵州', 364.85), ('海南', 93.42), ('河北', 1095.54), ('黑龙江', 493.52), ('河南', 857.87), ('湖北', 534.22), ('湖南', 429.94), ('江苏', 987.63), ('江西', 260.57), ('吉林', 379.06), ('辽宁', 975.6), ('内蒙古', 899.53), ('宁夏', 207.15), ('青海', 63.3), ('山东', 1488.18), ('山西', 1084.7), ('陕西', 529.89), ('四川', 552.87), ('新疆', 405.6), ('西藏', nan), ('云南', 321.42), ('浙江', 568.46), ('北京', 175.15), ('天津', 276.22), ('上海', 333.79), ('重庆', 263.46), ('台湾', nan)]\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min', 'china':'https://assets.pyecharts.org/assets/maps/china'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"ec0de7b5a9f04631bef637d86b173198\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts', 'china'], function(echarts) {\n",
       "                var chart_ec0de7b5a9f04631bef637d86b173198 = echarts.init(\n",
       "                    document.getElementById('ec0de7b5a9f04631bef637d86b173198'), 'white', {renderer: 'canvas'});\n",
       "                var option_ec0de7b5a9f04631bef637d86b173198 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"scatter\",\n",
       "            \"name\": \"\\u78b3\\u6392\\uff08Mt\\uff09\",\n",
       "            \"coordinateSystem\": \"geo\",\n",
       "            \"symbolSize\": 12,\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u5e7f\\u4e1c\",\n",
       "                    \"value\": [\n",
       "                        113.26653,\n",
       "                        23.132191,\n",
       "                        736.11\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5b89\\u5fbd\",\n",
       "                    \"value\": [\n",
       "                        117.284922,\n",
       "                        31.861184,\n",
       "                        469.95\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u798f\\u5efa\",\n",
       "                    \"value\": [\n",
       "                        119.295144,\n",
       "                        26.100779,\n",
       "                        324.31\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u7518\\u8083\",\n",
       "                    \"value\": [\n",
       "                        103.826308,\n",
       "                        36.059421,\n",
       "                        265.12\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5e7f\\u897f\",\n",
       "                    \"value\": [\n",
       "                        108.327546,\n",
       "                        22.815478,\n",
       "                        250.35\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8d35\\u5dde\",\n",
       "                    \"value\": [\n",
       "                        106.70741,\n",
       "                        26.598194,\n",
       "                        364.85\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6d77\\u5357\",\n",
       "                    \"value\": [\n",
       "                        110.349228,\n",
       "                        20.017377,\n",
       "                        93.42\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6cb3\\u5317\",\n",
       "                    \"value\": [\n",
       "                        114.468664,\n",
       "                        38.037057,\n",
       "                        1095.54\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9ed1\\u9f99\\u6c5f\",\n",
       "                    \"value\": [\n",
       "                        126.661669,\n",
       "                        45.742347,\n",
       "                        493.52\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6cb3\\u5357\",\n",
       "                    \"value\": [\n",
       "                        113.753602,\n",
       "                        34.765515,\n",
       "                        857.87\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6e56\\u5317\",\n",
       "                    \"value\": [\n",
       "                        114.341861,\n",
       "                        30.546498,\n",
       "                        534.22\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6e56\\u5357\",\n",
       "                    \"value\": [\n",
       "                        112.98381,\n",
       "                        28.112444,\n",
       "                        429.94\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6c5f\\u82cf\",\n",
       "                    \"value\": [\n",
       "                        118.763232,\n",
       "                        32.061707,\n",
       "                        987.63\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6c5f\\u897f\",\n",
       "                    \"value\": [\n",
       "                        115.909228,\n",
       "                        28.675696,\n",
       "                        260.57\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5409\\u6797\",\n",
       "                    \"value\": [\n",
       "                        125.32599,\n",
       "                        43.896536,\n",
       "                        379.06\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8fbd\\u5b81\",\n",
       "                    \"value\": [\n",
       "                        123.42944,\n",
       "                        41.835441,\n",
       "                        975.6\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5185\\u8499\\u53e4\",\n",
       "                    \"value\": [\n",
       "                        111.765617,\n",
       "                        40.817498,\n",
       "                        899.53\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5b81\\u590f\",\n",
       "                    \"value\": [\n",
       "                        106.258754,\n",
       "                        38.471317,\n",
       "                        207.15\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9752\\u6d77\",\n",
       "                    \"value\": [\n",
       "                        101.780199,\n",
       "                        36.620901,\n",
       "                        63.3\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5c71\\u4e1c\",\n",
       "                    \"value\": [\n",
       "                        117.020359,\n",
       "                        36.66853,\n",
       "                        1488.18\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5c71\\u897f\",\n",
       "                    \"value\": [\n",
       "                        112.562398,\n",
       "                        37.873531,\n",
       "                        1084.7\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9655\\u897f\",\n",
       "                    \"value\": [\n",
       "                        108.954239,\n",
       "                        34.265472,\n",
       "                        529.89\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u56db\\u5ddd\",\n",
       "                    \"value\": [\n",
       "                        104.075931,\n",
       "                        30.651651,\n",
       "                        552.87\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u65b0\\u7586\",\n",
       "                    \"value\": [\n",
       "                        87.627704,\n",
       "                        43.793026,\n",
       "                        405.6\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u897f\\u85cf\",\n",
       "                    \"value\": [\n",
       "                        91.117212,\n",
       "                        29.646922,\n",
       "                        null\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4e91\\u5357\",\n",
       "                    \"value\": [\n",
       "                        102.710002,\n",
       "                        25.045806,\n",
       "                        321.42\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6d59\\u6c5f\",\n",
       "                    \"value\": [\n",
       "                        120.152791,\n",
       "                        30.267446,\n",
       "                        568.46\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5317\\u4eac\",\n",
       "                    \"value\": [\n",
       "                        116.407526,\n",
       "                        39.90403,\n",
       "                        175.15\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5929\\u6d25\",\n",
       "                    \"value\": [\n",
       "                        117.200983,\n",
       "                        39.084158,\n",
       "                        276.22\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4e0a\\u6d77\",\n",
       "                    \"value\": [\n",
       "                        121.473701,\n",
       "                        31.230416,\n",
       "                        333.79\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u91cd\\u5e86\",\n",
       "                    \"value\": [\n",
       "                        106.551556,\n",
       "                        29.563009,\n",
       "                        263.46\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u53f0\\u6e7e\",\n",
       "                    \"value\": [\n",
       "                        121.509062,\n",
       "                        25.044332,\n",
       "                        null\n",
       "                    ]\n",
       "                }\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u78b3\\u6392\\uff08Mt\\uff09\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u78b3\\u6392\\uff08Mt\\uff09\": true\n",
       "            },\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"formatter\": function (params) {        return params.name + ' : ' + params.value[2];    },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u4e2d\\u56fd\\u5206\\u7701\\u78b3\\u6392\\u6570\\u636e\"\n",
       "        }\n",
       "    ],\n",
       "    \"visualMap\": {\n",
       "        \"show\": true,\n",
       "        \"type\": \"continuous\",\n",
       "        \"min\": 0,\n",
       "        \"max\": 100,\n",
       "        \"inRange\": {\n",
       "            \"color\": [\n",
       "                \"#50a3ba\",\n",
       "                \"#eac763\",\n",
       "                \"#d94e5d\"\n",
       "            ]\n",
       "        },\n",
       "        \"calculable\": true,\n",
       "        \"splitNumber\": 5,\n",
       "        \"orient\": \"vertical\",\n",
       "        \"showLabel\": true\n",
       "    },\n",
       "    \"geo\": {\n",
       "        \"map\": \"china\",\n",
       "        \"roam\": true,\n",
       "        \"emphasis\": {}\n",
       "    }\n",
       "};\n",
       "                chart_ec0de7b5a9f04631bef637d86b173198.setOption(option_ec0de7b5a9f04631bef637d86b173198);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x113af92e8>"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "df=pd.read_csv(\"china_province_carbon_emission.csv\")\n",
    "df\n",
    "print(list(df.province))\n",
    "print(list(df.emissions))\n",
    "分省碳排=list(zip(list(df.province),list(df.emissions)))\n",
    "print(分省碳排)\n",
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Geo\n",
    "from pyecharts.globals import ChartType, SymbolType\n",
    "def geo_碳排()-> Geo:\n",
    "    c=(\n",
    "    Geo()\n",
    "    .add_schema(maptype=\"china\")\n",
    "    .add(\"碳排（Mt）\",分省碳排)\n",
    "    .set_series_opts(label_opts=opts.LabelOpts(is_show=False))\n",
    "    .set_global_opts(\n",
    "            visualmap_opts=opts.VisualMapOpts(),\n",
    "            title_opts=opts.TitleOpts(title=\"中国分省碳排数据\"),\n",
    "          )\n",
    "    )\n",
    "    return c\n",
    "分省碳排地理图= geo_碳排()\n",
    "分省碳排地理图.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>province</th>\n",
       "      <th>emissions</th>\n",
       "      <th>GDP</th>\n",
       "      <th>POP</th>\n",
       "      <th>emissions_per_GDP</th>\n",
       "      <th>emissions_per_POP</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>广东</td>\n",
       "      <td>736.11</td>\n",
       "      <td>72812.55</td>\n",
       "      <td>10849.0</td>\n",
       "      <td>0.010110</td>\n",
       "      <td>0.067850</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>安徽</td>\n",
       "      <td>469.95</td>\n",
       "      <td>22005.63</td>\n",
       "      <td>6144.0</td>\n",
       "      <td>0.021356</td>\n",
       "      <td>0.076489</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>福建</td>\n",
       "      <td>324.31</td>\n",
       "      <td>25979.82</td>\n",
       "      <td>3839.0</td>\n",
       "      <td>0.012483</td>\n",
       "      <td>0.084478</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>甘肃</td>\n",
       "      <td>265.12</td>\n",
       "      <td>6790.32</td>\n",
       "      <td>2600.0</td>\n",
       "      <td>0.039044</td>\n",
       "      <td>0.101969</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>广西</td>\n",
       "      <td>250.35</td>\n",
       "      <td>16803.12</td>\n",
       "      <td>4796.0</td>\n",
       "      <td>0.014899</td>\n",
       "      <td>0.052200</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>贵州</td>\n",
       "      <td>364.85</td>\n",
       "      <td>10502.56</td>\n",
       "      <td>3530.0</td>\n",
       "      <td>0.034739</td>\n",
       "      <td>0.103357</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>海南</td>\n",
       "      <td>93.42</td>\n",
       "      <td>3702.76</td>\n",
       "      <td>911.0</td>\n",
       "      <td>0.025230</td>\n",
       "      <td>0.102547</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>河北</td>\n",
       "      <td>1095.54</td>\n",
       "      <td>29806.11</td>\n",
       "      <td>7425.0</td>\n",
       "      <td>0.036756</td>\n",
       "      <td>0.147547</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>黑龙江</td>\n",
       "      <td>493.52</td>\n",
       "      <td>15083.67</td>\n",
       "      <td>3812.0</td>\n",
       "      <td>0.032719</td>\n",
       "      <td>0.129465</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>河南</td>\n",
       "      <td>857.87</td>\n",
       "      <td>37002.16</td>\n",
       "      <td>9480.0</td>\n",
       "      <td>0.023184</td>\n",
       "      <td>0.090493</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>湖北</td>\n",
       "      <td>534.22</td>\n",
       "      <td>29550.19</td>\n",
       "      <td>5852.0</td>\n",
       "      <td>0.018078</td>\n",
       "      <td>0.091288</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>湖南</td>\n",
       "      <td>429.94</td>\n",
       "      <td>28902.21</td>\n",
       "      <td>6783.0</td>\n",
       "      <td>0.014876</td>\n",
       "      <td>0.063385</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>江苏</td>\n",
       "      <td>987.63</td>\n",
       "      <td>70116.38</td>\n",
       "      <td>7976.0</td>\n",
       "      <td>0.014086</td>\n",
       "      <td>0.123825</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>江西</td>\n",
       "      <td>260.57</td>\n",
       "      <td>16723.78</td>\n",
       "      <td>4566.0</td>\n",
       "      <td>0.015581</td>\n",
       "      <td>0.057067</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>吉林</td>\n",
       "      <td>379.06</td>\n",
       "      <td>14063.13</td>\n",
       "      <td>2753.0</td>\n",
       "      <td>0.026954</td>\n",
       "      <td>0.137690</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>辽宁</td>\n",
       "      <td>975.60</td>\n",
       "      <td>28669.02</td>\n",
       "      <td>4382.0</td>\n",
       "      <td>0.034030</td>\n",
       "      <td>0.222638</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>内蒙古</td>\n",
       "      <td>899.53</td>\n",
       "      <td>17831.51</td>\n",
       "      <td>2511.0</td>\n",
       "      <td>0.050446</td>\n",
       "      <td>0.358236</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>宁夏</td>\n",
       "      <td>207.15</td>\n",
       "      <td>2911.77</td>\n",
       "      <td>668.0</td>\n",
       "      <td>0.071142</td>\n",
       "      <td>0.310105</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>青海</td>\n",
       "      <td>63.30</td>\n",
       "      <td>2417.05</td>\n",
       "      <td>588.0</td>\n",
       "      <td>0.026189</td>\n",
       "      <td>0.107653</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>山东</td>\n",
       "      <td>1488.18</td>\n",
       "      <td>63002.33</td>\n",
       "      <td>9847.0</td>\n",
       "      <td>0.023621</td>\n",
       "      <td>0.151130</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>山西</td>\n",
       "      <td>1084.70</td>\n",
       "      <td>12766.49</td>\n",
       "      <td>3664.0</td>\n",
       "      <td>0.084965</td>\n",
       "      <td>0.296043</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>陕西</td>\n",
       "      <td>529.89</td>\n",
       "      <td>18021.86</td>\n",
       "      <td>3793.0</td>\n",
       "      <td>0.029403</td>\n",
       "      <td>0.139702</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>四川</td>\n",
       "      <td>552.87</td>\n",
       "      <td>30053.10</td>\n",
       "      <td>8204.0</td>\n",
       "      <td>0.018396</td>\n",
       "      <td>0.067390</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>新疆</td>\n",
       "      <td>405.60</td>\n",
       "      <td>9324.80</td>\n",
       "      <td>2360.0</td>\n",
       "      <td>0.043497</td>\n",
       "      <td>0.171864</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>西藏</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1026.39</td>\n",
       "      <td>324.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>云南</td>\n",
       "      <td>321.42</td>\n",
       "      <td>13619.17</td>\n",
       "      <td>4742.0</td>\n",
       "      <td>0.023601</td>\n",
       "      <td>0.067782</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>浙江</td>\n",
       "      <td>568.46</td>\n",
       "      <td>42886.49</td>\n",
       "      <td>5539.0</td>\n",
       "      <td>0.013255</td>\n",
       "      <td>0.102629</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>北京</td>\n",
       "      <td>175.15</td>\n",
       "      <td>23014.59</td>\n",
       "      <td>2171.0</td>\n",
       "      <td>0.007610</td>\n",
       "      <td>0.080677</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>天津</td>\n",
       "      <td>276.22</td>\n",
       "      <td>16538.19</td>\n",
       "      <td>1547.0</td>\n",
       "      <td>0.016702</td>\n",
       "      <td>0.178552</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>上海</td>\n",
       "      <td>333.79</td>\n",
       "      <td>25123.45</td>\n",
       "      <td>2415.0</td>\n",
       "      <td>0.013286</td>\n",
       "      <td>0.138215</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>重庆</td>\n",
       "      <td>263.46</td>\n",
       "      <td>15717.27</td>\n",
       "      <td>3017.0</td>\n",
       "      <td>0.016762</td>\n",
       "      <td>0.087325</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>台湾</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   province  emissions       GDP      POP  emissions_per_GDP  \\\n",
       "0        广东     736.11  72812.55  10849.0           0.010110   \n",
       "1        安徽     469.95  22005.63   6144.0           0.021356   \n",
       "2        福建     324.31  25979.82   3839.0           0.012483   \n",
       "3        甘肃     265.12   6790.32   2600.0           0.039044   \n",
       "4        广西     250.35  16803.12   4796.0           0.014899   \n",
       "5        贵州     364.85  10502.56   3530.0           0.034739   \n",
       "6        海南      93.42   3702.76    911.0           0.025230   \n",
       "7        河北    1095.54  29806.11   7425.0           0.036756   \n",
       "8       黑龙江     493.52  15083.67   3812.0           0.032719   \n",
       "9        河南     857.87  37002.16   9480.0           0.023184   \n",
       "10       湖北     534.22  29550.19   5852.0           0.018078   \n",
       "11       湖南     429.94  28902.21   6783.0           0.014876   \n",
       "12       江苏     987.63  70116.38   7976.0           0.014086   \n",
       "13       江西     260.57  16723.78   4566.0           0.015581   \n",
       "14       吉林     379.06  14063.13   2753.0           0.026954   \n",
       "15       辽宁     975.60  28669.02   4382.0           0.034030   \n",
       "16      内蒙古     899.53  17831.51   2511.0           0.050446   \n",
       "17       宁夏     207.15   2911.77    668.0           0.071142   \n",
       "18       青海      63.30   2417.05    588.0           0.026189   \n",
       "19       山东    1488.18  63002.33   9847.0           0.023621   \n",
       "20       山西    1084.70  12766.49   3664.0           0.084965   \n",
       "21       陕西     529.89  18021.86   3793.0           0.029403   \n",
       "22       四川     552.87  30053.10   8204.0           0.018396   \n",
       "23       新疆     405.60   9324.80   2360.0           0.043497   \n",
       "24       西藏        NaN   1026.39    324.0                NaN   \n",
       "25       云南     321.42  13619.17   4742.0           0.023601   \n",
       "26       浙江     568.46  42886.49   5539.0           0.013255   \n",
       "27       北京     175.15  23014.59   2171.0           0.007610   \n",
       "28       天津     276.22  16538.19   1547.0           0.016702   \n",
       "29       上海     333.79  25123.45   2415.0           0.013286   \n",
       "30       重庆     263.46  15717.27   3017.0           0.016762   \n",
       "31       台湾        NaN       NaN      NaN                NaN   \n",
       "\n",
       "    emissions_per_POP  \n",
       "0            0.067850  \n",
       "1            0.076489  \n",
       "2            0.084478  \n",
       "3            0.101969  \n",
       "4            0.052200  \n",
       "5            0.103357  \n",
       "6            0.102547  \n",
       "7            0.147547  \n",
       "8            0.129465  \n",
       "9            0.090493  \n",
       "10           0.091288  \n",
       "11           0.063385  \n",
       "12           0.123825  \n",
       "13           0.057067  \n",
       "14           0.137690  \n",
       "15           0.222638  \n",
       "16           0.358236  \n",
       "17           0.310105  \n",
       "18           0.107653  \n",
       "19           0.151130  \n",
       "20           0.296043  \n",
       "21           0.139702  \n",
       "22           0.067390  \n",
       "23           0.171864  \n",
       "24                NaN  \n",
       "25           0.067782  \n",
       "26           0.102629  \n",
       "27           0.080677  \n",
       "28           0.178552  \n",
       "29           0.138215  \n",
       "30           0.087325  \n",
       "31                NaN  "
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "df=pd.read_csv(\"china_province_carbon_emission.csv\")\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['广东', '安徽', '福建', '甘肃', '广西', '贵州', '海南', '河北', '黑龙江', '河南', '湖北', '湖南', '江苏', '江西', '吉林', '辽宁', '内蒙古', '宁夏', '青海', '山东', '山西', '陕西', '四川', '新疆', '西藏', '云南', '浙江', '北京', '天津', '上海', '重庆', '台湾']\n",
      "[736.11, 469.95, 324.31, 265.12, 250.35, 364.85, 93.42, 1095.54, 493.52, 857.87, 534.22, 429.94, 987.63, 260.57, 379.06, 975.6, 899.53, 207.15, 63.3, 1488.18, 1084.7, 529.89, 552.87, 405.6, nan, 321.42, 568.46, 175.15, 276.22, 333.79, 263.46, nan]\n",
      "[('广东', 736.11), ('安徽', 469.95), ('福建', 324.31), ('甘肃', 265.12), ('广西', 250.35), ('贵州', 364.85), ('海南', 93.42), ('河北', 1095.54), ('黑龙江', 493.52), ('河南', 857.87), ('湖北', 534.22), ('湖南', 429.94), ('江苏', 987.63), ('江西', 260.57), ('吉林', 379.06), ('辽宁', 975.6), ('内蒙古', 899.53), ('宁夏', 207.15), ('青海', 63.3), ('山东', 1488.18), ('山西', 1084.7), ('陕西', 529.89), ('四川', 552.87), ('新疆', 405.6), ('西藏', nan), ('云南', 321.42), ('浙江', 568.46), ('北京', 175.15), ('天津', 276.22), ('上海', 333.79), ('重庆', 263.46), ('台湾', nan)]\n"
     ]
    }
   ],
   "source": [
    "print(list(df.province))\n",
    "print(list(df.emissions))\n",
    "分省碳排=list(zip(list(df.province),list(df.emissions)))\n",
    "print(分省碳排)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Geo\n",
    "from pyecharts.globals import ChartType, SymbolType\n",
    "def geo_碳排()-> Geo:\n",
    "    c=(\n",
    "    Geo()\n",
    "    .add_schema(maptype=\"china\")\n",
    "    .add(\"碳排（Mt）\",分省碳排)\n",
    "    .set_series_opts(label_opts=opts.LabelOpts(is_show=False))\n",
    "    .set_global_opts(\n",
    "            visualmap_opts=opts.VisualMapOpts(),\n",
    "            title_opts=opts.TitleOpts(title=\"中国分省碳排数据\"),\n",
    "          )\n",
    "   )\n",
    "    return c "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min', 'china':'https://assets.pyecharts.org/assets/maps/china'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"131bd0d991c84de590400867d93b7781\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts', 'china'], function(echarts) {\n",
       "                var chart_131bd0d991c84de590400867d93b7781 = echarts.init(\n",
       "                    document.getElementById('131bd0d991c84de590400867d93b7781'), 'white', {renderer: 'canvas'});\n",
       "                var option_131bd0d991c84de590400867d93b7781 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"scatter\",\n",
       "            \"name\": \"\\u78b3\\u6392\\uff08Mt\\uff09\",\n",
       "            \"coordinateSystem\": \"geo\",\n",
       "            \"symbolSize\": 12,\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u5e7f\\u4e1c\",\n",
       "                    \"value\": [\n",
       "                        113.26653,\n",
       "                        23.132191,\n",
       "                        736.11\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5b89\\u5fbd\",\n",
       "                    \"value\": [\n",
       "                        117.284922,\n",
       "                        31.861184,\n",
       "                        469.95\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u798f\\u5efa\",\n",
       "                    \"value\": [\n",
       "                        119.295144,\n",
       "                        26.100779,\n",
       "                        324.31\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u7518\\u8083\",\n",
       "                    \"value\": [\n",
       "                        103.826308,\n",
       "                        36.059421,\n",
       "                        265.12\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5e7f\\u897f\",\n",
       "                    \"value\": [\n",
       "                        108.327546,\n",
       "                        22.815478,\n",
       "                        250.35\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8d35\\u5dde\",\n",
       "                    \"value\": [\n",
       "                        106.70741,\n",
       "                        26.598194,\n",
       "                        364.85\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6d77\\u5357\",\n",
       "                    \"value\": [\n",
       "                        110.349228,\n",
       "                        20.017377,\n",
       "                        93.42\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6cb3\\u5317\",\n",
       "                    \"value\": [\n",
       "                        114.468664,\n",
       "                        38.037057,\n",
       "                        1095.54\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9ed1\\u9f99\\u6c5f\",\n",
       "                    \"value\": [\n",
       "                        126.661669,\n",
       "                        45.742347,\n",
       "                        493.52\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6cb3\\u5357\",\n",
       "                    \"value\": [\n",
       "                        113.753602,\n",
       "                        34.765515,\n",
       "                        857.87\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6e56\\u5317\",\n",
       "                    \"value\": [\n",
       "                        114.341861,\n",
       "                        30.546498,\n",
       "                        534.22\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6e56\\u5357\",\n",
       "                    \"value\": [\n",
       "                        112.98381,\n",
       "                        28.112444,\n",
       "                        429.94\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6c5f\\u82cf\",\n",
       "                    \"value\": [\n",
       "                        118.763232,\n",
       "                        32.061707,\n",
       "                        987.63\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6c5f\\u897f\",\n",
       "                    \"value\": [\n",
       "                        115.909228,\n",
       "                        28.675696,\n",
       "                        260.57\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5409\\u6797\",\n",
       "                    \"value\": [\n",
       "                        125.32599,\n",
       "                        43.896536,\n",
       "                        379.06\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8fbd\\u5b81\",\n",
       "                    \"value\": [\n",
       "                        123.42944,\n",
       "                        41.835441,\n",
       "                        975.6\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5185\\u8499\\u53e4\",\n",
       "                    \"value\": [\n",
       "                        111.765617,\n",
       "                        40.817498,\n",
       "                        899.53\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5b81\\u590f\",\n",
       "                    \"value\": [\n",
       "                        106.258754,\n",
       "                        38.471317,\n",
       "                        207.15\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9752\\u6d77\",\n",
       "                    \"value\": [\n",
       "                        101.780199,\n",
       "                        36.620901,\n",
       "                        63.3\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5c71\\u4e1c\",\n",
       "                    \"value\": [\n",
       "                        117.020359,\n",
       "                        36.66853,\n",
       "                        1488.18\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5c71\\u897f\",\n",
       "                    \"value\": [\n",
       "                        112.562398,\n",
       "                        37.873531,\n",
       "                        1084.7\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9655\\u897f\",\n",
       "                    \"value\": [\n",
       "                        108.954239,\n",
       "                        34.265472,\n",
       "                        529.89\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u56db\\u5ddd\",\n",
       "                    \"value\": [\n",
       "                        104.075931,\n",
       "                        30.651651,\n",
       "                        552.87\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u65b0\\u7586\",\n",
       "                    \"value\": [\n",
       "                        87.627704,\n",
       "                        43.793026,\n",
       "                        405.6\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u897f\\u85cf\",\n",
       "                    \"value\": [\n",
       "                        91.117212,\n",
       "                        29.646922,\n",
       "                        null\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4e91\\u5357\",\n",
       "                    \"value\": [\n",
       "                        102.710002,\n",
       "                        25.045806,\n",
       "                        321.42\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6d59\\u6c5f\",\n",
       "                    \"value\": [\n",
       "                        120.152791,\n",
       "                        30.267446,\n",
       "                        568.46\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5317\\u4eac\",\n",
       "                    \"value\": [\n",
       "                        116.407526,\n",
       "                        39.90403,\n",
       "                        175.15\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5929\\u6d25\",\n",
       "                    \"value\": [\n",
       "                        117.200983,\n",
       "                        39.084158,\n",
       "                        276.22\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4e0a\\u6d77\",\n",
       "                    \"value\": [\n",
       "                        121.473701,\n",
       "                        31.230416,\n",
       "                        333.79\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u91cd\\u5e86\",\n",
       "                    \"value\": [\n",
       "                        106.551556,\n",
       "                        29.563009,\n",
       "                        263.46\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u53f0\\u6e7e\",\n",
       "                    \"value\": [\n",
       "                        121.509062,\n",
       "                        25.044332,\n",
       "                        null\n",
       "                    ]\n",
       "                }\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u78b3\\u6392\\uff08Mt\\uff09\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u78b3\\u6392\\uff08Mt\\uff09\": true\n",
       "            },\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"formatter\": function (params) {        return params.name + ' : ' + params.value[2];    },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u4e2d\\u56fd\\u5206\\u7701\\u78b3\\u6392\\u6570\\u636e\"\n",
       "        }\n",
       "    ],\n",
       "    \"visualMap\": {\n",
       "        \"show\": true,\n",
       "        \"type\": \"continuous\",\n",
       "        \"min\": 0,\n",
       "        \"max\": 100,\n",
       "        \"inRange\": {\n",
       "            \"color\": [\n",
       "                \"#50a3ba\",\n",
       "                \"#eac763\",\n",
       "                \"#d94e5d\"\n",
       "            ]\n",
       "        },\n",
       "        \"calculable\": true,\n",
       "        \"splitNumber\": 5,\n",
       "        \"orient\": \"vertical\",\n",
       "        \"showLabel\": true\n",
       "    },\n",
       "    \"geo\": {\n",
       "        \"map\": \"china\",\n",
       "        \"roam\": true,\n",
       "        \"emphasis\": {}\n",
       "    }\n",
       "};\n",
       "                chart_131bd0d991c84de590400867d93b7781.setOption(option_131bd0d991c84de590400867d93b7781);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x100bdb518>"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "分省碳排地理图= geo_碳排()\n",
    "分省碳排地理图.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
